//
//  GrantReviewDetailViewController.m
//  DistributorAB
//
//  Created by 主事丫环 on 2019/9/26.
//  Copyright © 2019 主事丫环. All rights reserved.
//

#import "GrantReviewDetailViewController.h"
#import "WhetherToPassViewController.h"

@interface GrantReviewDetailViewController ()
@property (nonatomic,strong) UIScrollView *scrollView;
@property (nonatomic,strong) NSString *leftTitStr;
@property (nonatomic,strong) NSString *rightTitStr;

@end

@implementation GrantReviewDetailViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"查看详情";
    [self.leftbutton setImage:imgname(@"left_icon") forState:(UIControlStateNormal)];
    self.view.backgroundColor = [UIColor colorWithHexString:@"#F2F2F2"];
    
    [self showui];
    // Do any additional setup after loading the view.
}

-(void)showui{
    [self.view addSubview:self.scrollView];
    CGFloat wei = 60;
    CGFloat left1 = 26;
    CGFloat left2 = 14;
    
    CGFloat hh = 40;
    
    UIView *bbgvieww = [[UIView alloc]init];
    bbgvieww.backgroundColor = [UIColor orangeColor];
    [self.scrollView addSubview:bbgvieww];
    //[bbgvieww shadowshadowOpacity:0.2 borderWidth:1 borderColor:[UIColor whiteColor] erRadius:12 shadowColor:[UIColor colorWithHexString:@"#000000"] shadowRadius:3 shadowOffset:CGSizeMake(1, 1)];
    
    UILabel *secvice = [[UILabel alloc]initWithFrame:CGRectMake(left1, hh, wei, 14)];
    secvice.font = FontSize(14);
    secvice.textColor = K999999;
    secvice.text = @"所在地区";
    [self.scrollView addSubview:secvice];
    
    UILabel *secvicelb = [[UILabel alloc]initWithFrame:CGRectMake(left1+wei+left2, hh, KWIDTH-left2-left1-wei-left1-20, 14)];
    secvicelb.font = FontSize(14);
    secvicelb.textColor = K333333;
    //secvicelb.text = _mymodel.service_name;
    secvicelb.text = @"河南省 郑州市 新郑市";
    [self.scrollView addSubview:secvicelb];
    
    UILabel *line2 = [[UILabel alloc]initWithFrame:CGRectMake(left1, secvicelb.bottom+10, KWIDTH-left1-20, 1)];
    line2.backgroundColor = [UIColor colorWithHexString:@"#F2F2F2"];
    [self.scrollView addSubview:line2];
    
    UILabel *produrt = [[UILabel alloc]initWithFrame:CGRectMake(left1, line2.bottom+8, wei, 14)];
    produrt.font = FontSize(14);
    produrt.textColor = K999999;
    produrt.text = @"师傅姓名";
    [self.scrollView addSubview:produrt];
    
    UILabel *produrtlb = [[UILabel alloc]initWithFrame:CGRectMake(left1+wei+left2, line2.bottom+8, 180, 14)];
    produrtlb.font = FontSize(14);
    produrtlb.textColor = K666666;
    //produrtlb.text = _mymodel.fault_name;
    produrtlb.text = @"白师傅";
    [self.scrollView addSubview:produrtlb];
    
    UILabel *line3 = [[UILabel alloc]initWithFrame:CGRectMake(left1, produrt.bottom+10, KWIDTH-left1-20, 1)];
    line3.backgroundColor = [UIColor colorWithHexString:@"#F2F2F2"];
    [self.scrollView addSubview:line3];
    
    UILabel *faultReasonL = [[UILabel alloc]initWithFrame:CGRectMake(left1, line3.bottom+8, wei, 14)];
    faultReasonL.font = FontSize(14);
    faultReasonL.textColor = K999999;
    faultReasonL.text = @"联系电话";
    [self.scrollView addSubview:faultReasonL];
    
    UILabel *faultReason = [[UILabel alloc]initWithFrame:CGRectMake(left1+wei+left2, line3.bottom+8, KWIDTH-left2-left1-wei-left1-20, 14)];
    faultReason.font = FontSize(14);
    faultReason.textColor = K666666;
    //faultReason.text = _mymodel.common_failures;
    faultReason.text = @"13587466921";
    [self.scrollView addSubview:faultReason];
    
    UILabel *line = [[UILabel alloc]initWithFrame:CGRectMake(left1, faultReason.bottom+10, KWIDTH-left1-20, 1)];
    line.backgroundColor = [UIColor colorWithHexString:@"#F2F2F2"];
    [self.scrollView addSubview:line];
    
    UILabel *faultCountL = [[UILabel alloc]initWithFrame:CGRectMake(left1, line.bottom+8, wei, 14)];
    faultCountL.font = FontSize(14);
    faultCountL.textColor = K999999;
    faultCountL.text = @"出厂时间";
    [self.scrollView addSubview:faultCountL];
    
    UILabel *faultCount = [[UILabel alloc]initWithFrame:CGRectMake(left1+wei+left2, line.bottom+8, KWIDTH-left2-left1-wei-left1-20, 14)];
    faultCount.font = FontSize(14);
    faultCount.textColor = K666666;
    //faultCount.text = _mymodel.common_failures;
    faultCount.text = @"2019-01-01 11:14:21";
    [self.scrollView addSubview:faultCount];
    
    UILabel *line01 = [[UILabel alloc]initWithFrame:CGRectMake(left1, faultCountL.bottom+10, KWIDTH-left1-20, 1)];
    line01.backgroundColor = [UIColor colorWithHexString:@"#F2F2F2"];
    [self.scrollView addSubview:line01];
    
    UILabel *guzhang = [[UILabel alloc]initWithFrame:CGRectMake(left1, line01.bottom+8, 90, 14)];
    guzhang.font = FontSize(14);
    guzhang.textColor = K999999;
    guzhang.text = @"安装时间";
    [self.scrollView addSubview:guzhang];
    
    //CGFloat heig = [NSString heightWithWidth:KWIDTH-left2-left1-wei-left1-20 font:14 text:_mymodel.fault_comment];
    
    //CGFloat heig = [NSString heightWithWidth:KWIDTH-left2-left1-wei-left1-20 font:14 text:@"坏了就是坏了,加价时空裂缝敬爱为奇偶我瓯江口冷风机爱哦文化节佛IQ文件覅偶文具盒覅偶去我家覅偶教我我我请假额覅偶积分 "];
    
    UILabel *guzhanglb = [[UILabel alloc]initWithFrame:CGRectMake(left1+wei+left2, line01.bottom+8, KWIDTH-left2-left1-wei-left1-20, 14)];
    guzhanglb.font = FontSize(14);
    guzhanglb.textColor = K666666;
    //guzhanglb.text = _mymodel.fault_comment;
    guzhanglb.text = @"2019-01-01 11:14:21";
    guzhanglb.numberOfLines = 0;
    [self.scrollView addSubview:guzhanglb];
    //heig = 14;
    
    UILabel *line6 = [[UILabel alloc]initWithFrame:CGRectMake(left1, guzhanglb.bottom+10, KWIDTH-left1-20, 1)];
    line6.backgroundColor = [UIColor colorWithHexString:@"#F2F2F2"];
    [self.scrollView addSubview:line6];
    
    UILabel *yuyueDateL = [[UILabel alloc]initWithFrame:CGRectMake(left1, line6.bottom+8, wei, 14)];
    yuyueDateL.font = FontSize(14);
    yuyueDateL.textColor = K999999;
    yuyueDateL.text = @"损坏时间";
    [self.scrollView addSubview:yuyueDateL];
    
    UILabel *yuyueDate = [[UILabel alloc]initWithFrame:CGRectMake(left1+wei+left2, line6.bottom+8, KWIDTH-left2-left1-wei-left1-20, 14)];
    yuyueDate.font = FontSize(14);
    yuyueDate.textColor = K666666;
    //yuyueDate.text = _mymodel.common_failures;
    yuyueDate.text = @"2019-09-25 11:14:21";
    [self.scrollView addSubview:yuyueDate];
    
    UILabel *line02 = [[UILabel alloc]initWithFrame:CGRectMake(left1, yuyueDateL.bottom+10, KWIDTH-left1-20, 1)];
    line02.backgroundColor = [UIColor colorWithHexString:@"#F2F2F2"];
    [self.scrollView addSubview:line02];
    
    UILabel *placeLab = [[UILabel alloc] init];
    placeLab.backgroundColor = [UIColor whiteColor];
    placeLab.frame = CGRectMake(10, line02.bottom+22, KWIDTH-20, 199);
    placeLab.layer.borderWidth = 1;
    placeLab.layer.borderColor = [UIColor colorWithHexString:@"#70BE68"].CGColor;
    placeLab.layer.cornerRadius = 12;
    placeLab.layer.masksToBounds = YES;
    [self.scrollView addSubview:placeLab];
    
    UILabel *yuyueTimeL = [[UILabel alloc]initWithFrame:CGRectMake(16, 22, wei, 20)];
    yuyueTimeL.font = FontSize(14);
    yuyueTimeL.textColor = K999999;
    yuyueTimeL.text = @"配件品类";
    [placeLab addSubview:yuyueTimeL];

    UILabel *yuyueTime = [[UILabel alloc]initWithFrame:CGRectMake(16+wei+left2, 22, KWIDTH-left2-left1-wei-left1-20, 20)];
    yuyueTime.font = FontSize(14);
    yuyueTime.textColor = K333333;
    //yuyueTime.text = _mymodel.common_failures;
    yuyueTime.text = @"洗衣机 滚筒 电机";
    [placeLab addSubview:yuyueTime];

    UILabel *line03 = [[UILabel alloc]initWithFrame:CGRectMake(16, yuyueTimeL.bottom+5, KWIDTH-left1-20, 1)];
    line03.backgroundColor = [UIColor colorWithHexString:@"#F2F2F2"];
    [placeLab addSubview:line03];

    UILabel *address = [[UILabel alloc]initWithFrame:CGRectMake(16, line03.bottom+6, wei, 20)];
    address.font = FontSize(14);
    address.textColor = K999999;
    address.text = @"配件名称";
    [placeLab addSubview:address];

    //CGFloat heig22 = [NSString heightWithWidth:KWIDTH-80 font:14 text:_mymodel.user_address];
    //CGFloat heig22 = [NSString heightWithWidth:KWIDTH-80 font:14 text:@"坏了就是坏了,加价时空裂缝敬爱为奇偶偶积分坏了就是坏了,加价时空裂缝敬爱为奇偶偶积分"];

    UILabel *addresslb = [[UILabel alloc]initWithFrame:CGRectMake(16+wei+left2, line03.bottom+6, KWIDTH-80 , 20)];
    addresslb.font = FontSize(14);
    addresslb.textColor = K333333;
    //addresslb.text = _mymodel.user_address;
    addresslb.text = @"A5型";
    [placeLab addSubview:addresslb];

    UILabel *line11 = [[UILabel alloc]initWithFrame:CGRectMake(16, addresslb.bottom+10, KWIDTH-left1-20, 1)];
    line11.backgroundColor = [UIColor colorWithHexString:@"#F2F2F2"];
    [placeLab addSubview:line11];

    UILabel *dianti = [[UILabel alloc]initWithFrame:CGRectMake(16, line11.bottom+7, wei, 14)];
    dianti.font = FontSize(14);
    dianti.textColor = K999999;
    dianti.text = @"有效期";
    [placeLab addSubview:dianti];

    UILabel *diantilb = [[UILabel alloc]initWithFrame:CGRectMake(16+wei+left2, line11.bottom+7, KWIDTH-left2-left1-wei-left1-20, 14)];
    diantilb.font = FontSize(14);
    diantilb.textColor = K333333;
    diantilb.text = @"2019-10-30 至 2020-10-30";
    [placeLab addSubview:diantilb];

    UILabel *line8 = [[UILabel alloc]initWithFrame:CGRectMake(16, dianti.bottom+10, KWIDTH-left1-20, 1)];
    line8.backgroundColor = [UIColor colorWithHexString:@"#F2F2F2"];
    [placeLab addSubview:line8];

    UILabel *orderTimeL = [[UILabel alloc]initWithFrame:CGRectMake(16, line8.bottom+7, wei, 14)];
    orderTimeL.font = FontSize(14);
    orderTimeL.textColor = K999999;
    orderTimeL.text = @"质保期";
    [placeLab addSubview:orderTimeL];

    UILabel *orderTime = [[UILabel alloc]initWithFrame:CGRectMake(16+wei+left2, line8.bottom+7, KWIDTH-left2-left1-wei-left1-20, 14)];
    orderTime.font = FontSize(14);
    orderTime.textColor = K333333;
    orderTime.text = @"3个月";
    [placeLab addSubview:orderTime];
    orderTime.textAlignment = NSTextAlignmentLeft;
    
    UILabel *line9 = [[UILabel alloc]initWithFrame:CGRectMake(16, orderTimeL.bottom+10, KWIDTH-left1-20, 1)];
    line9.backgroundColor = [UIColor colorWithHexString:@"#F2F2F2"];
    [placeLab addSubview:line9];

    UILabel *pfjeTitL = [[UILabel alloc]initWithFrame:CGRectMake(16, line9.bottom+7, 80, 14)];
    pfjeTitL.font = FontSize(14);
    pfjeTitL.textColor = K999999;
    pfjeTitL.text = @"补贴工时费";
    [placeLab addSubview:pfjeTitL];
    
    UILabel *pfjeConL = [[UILabel alloc]initWithFrame:CGRectMake(16+wei+left2, line9.bottom+7, KWIDTH-left2-left1-wei-left1-20, 14)];
    pfjeConL.font = FontSize(14);
    pfjeConL.textColor = K333333;
    pfjeConL.text = @"￥30";
    [placeLab addSubview:pfjeConL];
    pfjeConL.textAlignment = NSTextAlignmentLeft;
    
    UILabel *line10 = [[UILabel alloc]initWithFrame:CGRectMake(0, placeLab.bottom+29, KWIDTH, 2)];
    line10.backgroundColor = [UIColor colorWithHexString:@"#F2F2F2"];
    [self.scrollView addSubview:line10];
    
    UILabel *shmsTitL = [[UILabel alloc]initWithFrame:CGRectMake(16, line10.bottom+22, 70, 14)];
    shmsTitL.font = FontSize(14);
    shmsTitL.textColor = K666666;
    shmsTitL.text = @"损坏描述:";
    [self.scrollView addSubview:shmsTitL];
    
    UITextView *textV = [[UITextView alloc] init];
    //textV.backgroundColor = [UIColor cyanColor];
    textV.font = FontSize(14);
    textV.text = @"描述描述描述";
    textV.layer.borderWidth = 1;
    textV.layer.borderColor = [UIColor colorWithHexString:@"#DBDBDB"].CGColor;
    textV.layer.cornerRadius = 8;
    textV.layer.masksToBounds = YES;
    textV.frame = CGRectMake(shmsTitL.right, line10.bottom +22, KWIDTH -16-70-10, 91);
    [self.scrollView addSubview:textV];
    
    bbgvieww.frame = CGRectMake(0, 10, KWIDTH, textV.bottom+20);
    bbgvieww.backgroundColor = [UIColor whiteColor];
    [bbgvieww shadowshadowOpacity:0.2 borderWidth:1 borderColor:[UIColor whiteColor] erRadius:1 shadowColor:[UIColor colorWithHexString:@"#000000"] shadowRadius:3 shadowOffset:CGSizeMake(1, 1)];
    self.scrollView.contentSize = CGSizeMake(KWIDTH, bbgvieww.bottom+20);
    
    UIButton *leftBtn = [[UIButton alloc] init];
    leftBtn.backgroundColor = [UIColor colorWithHexString:@"#70BE68"];
    leftBtn.frame = CGRectMake(14, bbgvieww.bottom+20, KWIDTH/2 -28, 48);
    NSString *leftTitStr = @"不通过";
    self.leftTitStr = leftTitStr;
    [leftBtn setTitle:leftTitStr forState:UIControlStateNormal];
    [leftBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    leftBtn.layer.cornerRadius = 4;
    leftBtn.layer.masksToBounds = YES;
    [leftBtn addTarget:self action:@selector(leftBtnAction:) forControlEvents:UIControlEventTouchUpInside];
    [self.scrollView addSubview:leftBtn];
    
    UIButton *rightBtn = [[UIButton alloc] init];
    rightBtn.backgroundColor = [UIColor colorWithHexString:@"#70BE68"];
    rightBtn.frame = CGRectMake(KWIDTH/2 +14, bbgvieww.bottom+20, KWIDTH/2 -28, 48);
    NSString *rightTitStr = @"通过";
    self.rightTitStr = rightTitStr;
    [rightBtn setTitle:rightTitStr forState:UIControlStateNormal];
    [rightBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    rightBtn.layer.cornerRadius = 4;
    rightBtn.layer.masksToBounds = YES;
    [rightBtn addTarget:self action:@selector(rightBtnAction:) forControlEvents:UIControlEventTouchUpInside];
    [self.scrollView addSubview:rightBtn];
    
}

//左侧 不通过 按钮 点击事件处理
- (void)leftBtnAction:(UIButton *)button {
    
    WhetherToPassViewController *passvc = [[WhetherToPassViewController alloc] init];
    passvc.titlestr = self.leftTitStr;

    [self.navigationController pushViewController:passvc animated:YES];
 
    NSLog(@"您点击了 左侧 的不通过 按钮");
}

//右侧 通过 按钮 点击事件梳理
- (void)rightBtnAction:(UIButton *)button {
    
    WhetherToPassViewController *passvc = [[WhetherToPassViewController alloc] init];
    passvc.titlestr = self.rightTitStr;
    
    [self.navigationController pushViewController:passvc animated:YES];
 
    NSLog(@"您点击了 右侧 的通过 按钮");
}

- (UIScrollView *)scrollView {
    if (!_scrollView) {
        _scrollView = [[UIScrollView alloc]initWithFrame:CGRectMake(0, kNaviHeight, KWIDTH, KHEIGHT-kNaviHeight)];
        _scrollView.backgroundColor = [UIColor colorWithHexString:@"#F2F2F2"];
        _scrollView.delegate = self;
        adjustInset(_scrollView);
    }
    return _scrollView;
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
